<?php echo $this->Html->css('inicio'); ?>

<?php if(empty($personas)) : ?>
<fieldset><legend> No hay personas </fieldset> </legend>
<?PHP   echo $this->Html->image('icon_pers/volver1.png');
        echo $this->Html->link('volver',array('action'=>'index'));
    ?> 
<?php echo $this->Html->link('Añadir usuarios',(array('action'=>'add'))); ?>
<?php else: ?>

    <?PHP   echo $this->Html->image('icon_pers/volver1.png');
        echo $this->Html->link('volver',array('action'=>'index'));
    ?> 
<br>
<fieldset>
    <legend> 
        Personas  
    </legend>
</fieldset>

<div id="anchoInput2">
    <?php
        echo $this->Form->create('buscar');
        echo $this-> Form->input('Busqueda', array('label'=>'Filtrar por rut'));
       
    ?>
</div>
<table>
    <tr>
        <th>Rut</th>
        <th>Nombre</th>
        <th>Apellido Paterno</th>
        <th>Apellido Materno</th>
        <th>Fecha Nacimiento</th>
    </tr>
    
    <?php foreach ($personas as $people): ?>
    <tr>
        <?php echo $this->Html->charset('UTF-8'); ?>
        
        
        <td><?php echo $people['Persona']['rut'] . '-' .$people['Persona']['dv']; ?></td>
        <td><?php echo $people['Persona']['nombre']; ?></td>
        <td><?php echo $people['Persona']['paterno']; ?></td>
        <td><?php echo $people['Persona']['materno']; ?></td>
        <td><?php echo $this->Time->timeAgoInWords($people['Persona']['fecha_nacimiento'] ); ?></td>
        

        
        <td><?php 
        echo $this->Html->image('icon_pers/edit.png');
        echo $this->Html->link(   'Editar',
                                            array('action'=>'edit',$people['Persona']['id']),  
                                            array(),
                                            "¿Esta seguro que desea modificar este registro?"
                                        );
            ?></td>
        <td><?php 
        echo $this->Html->image('icon_BOD/borrar.png'); 
        echo $this->Html->link(   'Eliminar',
                                            array('action'=>'delete',$people['Persona']['id']),  
                                            array(),
                                            "¿Esta seguro que desea eliminar este registro?"
                                        );
            ?></td>
    </tr>
    <?php endforeach; ?>
</table>

<?php echo $this->Html->image('icon_pers/addp1.png'); ?>
    <?php echo $this->Html->link('Añadir usuarios ',(array('action'=>'add'))); ?>
    <br>
    <?php echo $this->Html->image('icon_pers/ver.png'); ?>   
    <?php echo $this->Html->link('Mostrar los primeros 10 usuarios',(array('action'=>'index'))); ?>
    <br>
    <?php echo $this->Html->image('icon_pers/home.png'); ?>
    <?php echo $this->Html->link('home',(array('controller'=>'usuarios','action'=>'admin'))); ?>
<?php endif; ?>